<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--<%@ page import="com.qq.model.User" %>--%>
<%
    String path = request.getContextPath();
//    这里是通过USER注解来获取用户名，因为这里我用了el表达式所有就注解了
    //User user = (User)session.getAttribute("USER");
%>
<%--bg-dark mb-3这里是加边距--%>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark bg-dark mb-3">
    <a class="navbar-brand" href="#">图书管理系统</a>

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="navbar-nav mr-auto">
            <li class="nav-item active">
                 <%--这里是通过Java代码进行定义<%=path%>--%>
                <a class="nav-link" href="<%=path%>/bood/index01">首页1</a>
            </li>
            <li class="nav-item">
                <%--这里是通过el表达式进行路径定义--%>
                <a class="nav-link" href="${pageContext.request.contextPath}/bood/index01">书籍2</a>
            </li>

            <li class="nav-item">
                <a class="nav-link" href="<c:url value='/a/b/c/d/e/f/g'/> ">书籍</a>
            </li>
        </ul>

        <ul class="navbar-nav">
            <li class="nav-item active">
              <%--这里用el表达式来显示用户名在导航条上还加了一个点--%>
                <a class="nav-link" href="#">用户名:${USER.name}</a>
              <%-- 这里的el表达式好处就是容错性高，就是当你直接访问这个列表没登录，然后就在导航栏不会显示用户名的名字--%>
            </li>
            <li class="nav-item">
                <a href="<%=path%>/login" class="btn btn-sm btn-danger">注销</a>
            </li>
        </ul>
        &nbsp;&nbsp;&nbsp;&nbsp;
        <form class="form-inline my-2 my-lg-0">
            <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
            <button class="btn btn-sm btn-outline-success my-2 my-sm-0" type="submit">Search</button>
        </form>
    </div>
</nav>
